package com.ctu.study
{
	import flash.text.engine.*;
	import mx.core.UIComponent;
	
	public class TabStopExample extends UIComponent
	{
		public function TabStopExample()
		{
			var container:UIComponent = new UIComponent(); 
            
            var english:ElementFormat = new ElementFormat(); 
            english.fontDescription = new FontDescription("Arial"); 
            english.fontSize = 16;
            english.locale = "en"; 
            
            var tabStops:Vector.<TabStop> = new Vector.<TabStop>();    
            tabStops.push(
                new TabStop(TabAlignment.START, 20),
                new TabStop(TabAlignment.CENTER, 120),
                new TabStop(TabAlignment.DECIMAL, 220, "."),
                new TabStop(TabAlignment.END, 320)
            ); 
    
            var textBlock:TextBlock = new TextBlock();
            textBlock.content = new TextElement(
                "\tstart\tcenter\tdeci.mal\tend\n" +        
                "\tlasdfasdasf\tl\t3.4\tl\n" +
                "\tlm\tlm\t234.56\tlm\n" +
                "\tlmn\tlmn\t12345678.34567\tlmn\n"
                , english); 
            textBlock.tabStops = tabStops;
            var y:Number = 60;
            var previousTextLine:TextLine = null; 
            var textLine:TextLine;
            var i:int;
            var tabOrigin:Number = 100;
            for (i = 0; i < 4; i++) {
                textLine = textBlock.createTextLine(previousTextLine, 1000, 0); 
                textLine.x = 20;
                textLine.y = y; 
                
                container.addChild(textLine);     
                
                y += 25; 
                previousTextLine = textLine; 
            }
            addChild(container);   
		}

	}
}